<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	'enableAjaxValidation'=>true,
)); ?>

	<?php echo Yii::t('admin','<p class="note">Fields with <span class="required">*</span> are required.</p>');?>	

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'user_name'); ?>
		<?php echo $form->textField($model,'user_name',array('style'=>'width:95%;')); ?>
		<?php echo $form->error($model,'user_name'); ?>
	</div>
	<?php if($model->isNewRecord):?>
	<div class="row">
		<?php echo $form->labelEx($model,'user_password'); ?>
		<?php echo $form->textField($model,'user_password',array('style'=>'width:95%;')); ?>
		<?php echo $form->error($model,'user_password'); ?>
	</div>
	<?php else:?>
	<div class="row">
		<?php echo $form->hiddenField($model,'user_password',array('style'=>'width:95%;')); ?>
		<?php echo $form->error($model,'user_password'); ?>
	</div>		
	<?php endif;?>

	<div class="row">
		<?php echo $form->labelEx($model,'user_group'); ?>
		<?php echo $form->dropDownList($model,'user_group',User::model()->getUserGroupArray(),
				array(
					'options'=>array($model->user_group=>array('selected'=>true)),
					'style'=>'width:50%;'
		)); ?>
		<?php echo $form->error($model,'user_group'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'user_remark'); ?>
		<?php echo $form->textArea($model,'user_remark',array('style'=>'width:95%;')); ?>
		<?php echo $form->error($model,'user_remark'); ?>
	</div>
	<hr class="space" />
	<div class="row buttons">
	<?php
		$update = $this->createUrl('update',array('id'=>$model->user_id));
		$create = $this->createUrl('createajax');
		
		$this->widget('zii.widgets.jui.CJuiButton',
		array(
					'name'=>'button',
					'buttonType'=>'button',
					'caption'=>$model->isNewRecord ? Yii::t('admin', 'Create') : Yii::t('admin', 'Save'),
					'htmlOptions'=>array(
						'onclick'=>$model->isNewRecord?'actionCreate($(this));':'actionUpdate($(this));',
						'cid'=> $model->isNewRecord?$create:$update
		),
		));
	?>

	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->